<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	class Upfiles_model extends CI_Model{
		
		function __construct()
		{
			parent::__construct();
			$this->table = 'users_upfiles';
		}
		
		function Get($where=array())
		{
			return $this->db->select('*')
			  ->from($this->table)
			  ->where($where)
			  ->get()
			  ->row_array();
		}
		//取出列表
		public function GetList($where)
		{
			$this->db->select('*');
			$this->db->from($this->table);
			$this->db->where($where);
			$this->db->order_by($this->table.".id", "asc");
			$query = $this->db->get();
			return $query->result_array(); 
		}
	
		//插入数据
		function insert($data)
		{
			$this->db->insert($this->table, $data);
			//return $this->db->affected_rows();
			if($this->db->affected_rows()){
			   return $this->db->insert_id();
			}
		}
		//更新数据
		function update($data,$id)
		{
			return $this->db->where('id',$id)->update($this->table, $data);
		}
		//删除数据
		function dalete($delid)
		{	
			$this->db->where('id',$delid);
			$this->db->delete($this->table);
			return $this->db->affected_rows();
		}
		
		
	}